<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>
<head>
    <title>评价页面</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--标准mui.css-->
    <link rel="stylesheet" href="/Public/Css/css/mui.min.css">
    <script src="/Public/js/mui.min.js"></script>
    <!--标准muiEND-->
    <link rel="stylesheet" href="/Public/weui/style/weui.min.css"/>
    <style>
        body{
            background-color:#fff;
        }
        .evaluate-box{
            padding:15px;
        }
        .evaluate-text{
            display:block;
            width:300px;
            margin:30px auto;
            height:200px;
            resize:none;
            padding:8px;
            font-size:13px;
            color:#333;
            border-radius:4px;
        }
        .evaluate-text:focus{
            border-color:#04be02;
        }
    </style>
</head>
<body>
<div class="evaluate-box">

    <textarea style="-webkit-user-select: auto!important;" contenteditable="true" class="evaluate-text js_evaluate_txt" placeholder="请填写投诉内容"></textarea>

    <a href="javascript:;" class="weui_btn weui_btn_primary js_form_submit">
        提交投诉
    </a>
</div>
<script src="//libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    $(function(){

        var stars = $(".js_service_star,.js_driver_star,.js_car_star");
        var submit = $(".js_form_submit");

        stars.on('click','.item',function(e){
            var $this = $(this);
            var index = $this.index();
            var parent = $this.parent();
            $this.removeClass('active').siblings().removeClass('active');
            for(var i = 0; i <= index; i++){
                parent.children().eq(i).addClass('active');
            }
            parent.attr('data-star',index+1);
        })

        submit.on('click',function(){
            var txt = $(".js_evaluate_txt").val();
            var orderid = '<?php echo ($orderid); ?>';

            if(!txt.length || txt == null ){
                alert('投诉内容不能为空！');
                return;
            }

            console.log(orderid);
            if(!orderid){
                alert('订单信息不存在，评价失败！');
                return;
            }
            $.ajax({
                type: "post",
                url: "/index.php/Complaint/createComplaint",
                data: {detail: txt,orderid: orderid},
                dataType: "json",
                success: function (data) {
                    if(data.code == 1){
                        window.location.href = document.referrer;
                    }else{
                        alert('网络错误，提交失败！');
                    }
                }
            });


        })
    })

</script>

</body>
</html>